package com.example.kt_base.s6

//TODO 111.Kotlin语言的in 逆变
fun main() {
    val p1:Consumer<Man> =ConsumerClass1()
    val p2:Consumer<WoMan> =ConsumerClass2()
    val m=Man()
    val w=WoMan()
    p1.consumer(m)
    p2.consumer(w)


}


class ConsumerClass1:Consumer<Animal>{
    override fun consumer(item: Animal ){
        println("消费者 Animal")
    }
}

class ConsumerClass2:Consumer<Humanity>{
    override fun consumer(item: Humanity ){
        println("消费者 Humanity")
    }
}

class ConsumerClass3:Consumer<Man>{
    override fun consumer(item: Man ){
        println("消费者 Man")
    }
}

class ConsumerClass4:Consumer<WoMan>{
    override fun consumer(item: WoMan ){
        println("消费者 WoMan")
    }
}

